package controllers

import (
	"net/http"

	"gitee.com/liuyongchina/init-project/services"
	"github.com/gin-gonic/gin"
	"github.com/spf13/cast"
)

type HelloController struct {
}

func NewHello() *HelloController {
	return new(HelloController)
}
func (hc *HelloController) Index(c *gin.Context) {
	id := cast.ToInt(c.DefaultQuery("id", "0"))
	result := services.NewHelloSevice().Test(id)
	c.JSON(http.StatusOK, gin.H{
		"code": 200,
		"msg":  "请求成功1",
		"data": result,
	})
	return
}
